package Com.amit.Exception;

class InvalidAgeException extends Exception
{
	InvalidAgeException(String s)
	{
		super(s);
	}
}

public class Lab125 {
	
	void valid(int a) throws InvalidAgeException
	{
		if(a<18)
		{
			throw new InvalidAgeException("not valid");
		}
		else
		{
			System.out.println("please vote");
		}
	}

	public static void main(String[] args) 
	{
		try
		{
			Lab125 l=new Lab125();
			l.valid(10);
		}
		
		catch (Exception e) {
		System.out.println(e);
			System.out.println("Handled");
		}
		
		System.out.println("rest of code");
	}

}
